package com.xzan.medusa.core.manager.impl;

import com.xzan.medusa.common.query.PageResult;
import com.xzan.medusa.dal.model.StockStrategyDO;
import com.xzan.medusa.dal.query.StockStrategyQuery;
import com.xzan.medusa.dal.mapper.ext.StockStrategyExtMapper;
import com.xzan.medusa.core.manager.StockStrategyManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for StockStrategy.
 */

@Component
public class StockStrategyManagerImpl implements StockStrategyManager{

    
    @Autowired
    protected StockStrategyExtMapper stockStrategyExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(StockStrategyQuery query){
        return stockStrategyExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(StockStrategyQuery query){
        return stockStrategyExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(StockStrategyDO record){
        return stockStrategyExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(StockStrategyDO record){
        return stockStrategyExtMapper.insertSelective(record);
    }

    /**
     * insert selective.
     */
    @Override
    public int batchInsert(List<StockStrategyDO> records){
        return stockStrategyExtMapper.batchInsert(records);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<StockStrategyDO> selectByQuery(StockStrategyQuery query){
        return stockStrategyExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<StockStrategyDO> selectByQueryWithPage(StockStrategyQuery query) {
        PageResult<StockStrategyDO> result = new PageResult<StockStrategyDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public StockStrategyDO selectByPrimaryKey(Long id){
        return stockStrategyExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( StockStrategyDO record,  StockStrategyQuery query){
        return stockStrategyExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( StockStrategyDO record,  StockStrategyQuery query){

        return stockStrategyExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(StockStrategyDO record){
        return stockStrategyExtMapper.updateByPrimaryKeySelective(record);
    }
}